package com.cp.support.gray;

import com.cp.support.HeaderConstant;
import com.cp.util.SceneTag;
import com.cp.util.SystemThreadLocal;
import feign.RequestInterceptor;
import feign.RequestTemplate;

/**
 * 灰度发布拦截器
 *
 * @author YangXiaoLong
 * 2022/11/1 23:40
 */
public class GrayFeignRequestInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        Object o = SystemThreadLocal.get(SceneTag.GRAY.getTag());
        if (o != null) {
            requestTemplate.header(HeaderConstant.GRAY_RELEASE, String.valueOf(o));
        }

    }
}
